/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						       dialog_campaign.h

	$Header: /game/dialog_campaign.h $

	$NoKeywords: $

 ************************************************************************/
#ifndef CAMPAIGN_DIALOG_H_INCLUDED
#define CAMPAIGN_DIALOG_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

// kill the 255+ character identifier warning.  Templates tend to exceed that easily.
#pragma warning( disable: 4786 )

#include <vector>
#include "adventure_map.h"
#include "bitmap_group_ptr.h"
#include "bitmap_layer_window.h"
#include "bitmap_layer_window_ptr.h"
#include "button_group.h"
#include "campaign_file_header.h"
#include "dialog_box.h"
#include "font_cache.h"
#include "playing_sound.h"
#include "playing_sound_ptr.h"
#include "sound.h"
#include "sound_cache.h"
#include "text_window_ptr.h"

class t_bitmap_group_window;

// ---------------------------------------------------------------------
// dialog to show single scenario info
// ---------------------------------------------------------------------
class t_scenario_dialog : public t_window
{
public:
	t_scenario_dialog( t_window* parent, t_campaign_file_header_ptr const header_ptr, int map_selected, bool is_prologue = true, t_adventure_map* map = 0 ); 
	t_difficulty	get_difficulty() const;
	bool			guards_can_move() const;

protected:
	t_toggle_button* add_tab( const char* tab_name, std::string const& label, 
					std::string const& help_text,
					bool pressed );
	void add_tab( const char* tab_name, std::string const& label, 
					std::string const& help_text,
					void (t_scenario_dialog::*function)(t_button*),
					bool pressed );
	t_text_window* add_text( std::string const& text, std::string const& layer_name, 
		                     int size, bool size_explicit = false, bool center = true, t_window* const parent = NULL );
	void			begin_clicked( t_button* button );
	void			cancel_clicked( t_button* button );
	void			create_buttons();
	void			create_icons();
	void			create_scenario_details_controls();
	void			create_scenario_info_controls();
	void			create_text();
	t_screen_point	find_location( std::string const& layer_name ) const;
	void			guard_clicked( t_button* button );
	void			initialize();
	void			init_voice_over();
	void			pause_clicked( t_button* button );
	void			play_voice_over_sound();
	void			replay_clicked( t_button* button );
	virtual void	scenario_details_clicked( t_button* button );
	virtual void	scenario_info_clicked( t_button* button );
	void			set_difficulty( t_difficulty difficulty );
		                       
	t_adventure_map*					m_adventure_map;
    t_window_ptr                        m_background;					// overall background
	t_difficulty						m_difficulty;
	t_bitmap_group_ptr					m_difficulty_icons;
	t_button_ptr					    m_difficulty_left_button;
	t_button_ptr					    m_difficulty_right_button;
	t_text_window*						m_difficulty_window;
	t_campaign_file_header_ptr const	m_file_header_ptr;
	bool								m_guards_can_move;
	t_text_window*						m_guards_can_move_window;
	t_bitmap_group_ptr					m_layout;
	t_bitmap_group_ptr					m_layout_splashscreen;
	int									m_map_selected;
	t_bitmap_group_ptr					m_map_size_icons;
	t_window*							m_parent;
	bool								m_paused;
	t_window_ptr						m_player_difficulty_box;
	t_bitmap_group_window*				m_player_difficulty_window;
//	t_bitmap_layer_window*				m_player_difficulty_window;
	t_window_ptr                        m_scenario_info_controls;
	t_window_ptr                        m_scenario_details_controls;
	t_button_group                      m_tabs;							// campaign info / scenario info / scenario details
	t_playing_sound_ptr					m_sound;
	int									m_sound_length;
	bool								m_suspended;
	t_scrolling_text_window*			m_voice_window;
	bool								m_is_prologue;
};

// ---------------------------------------------------------------------
// inline t_scenario_dialog member functions
// ---------------------------------------------------------------------
inline t_difficulty t_scenario_dialog::get_difficulty() const
{
	return m_difficulty;
}

inline bool t_scenario_dialog::guards_can_move() const
{
	return m_guards_can_move;
}

// ---------------------------------------------------------------------
// dialog to show multi-scenario info
// ---------------------------------------------------------------------
class t_multi_scenario_dialog : public t_scenario_dialog
{
public:
	t_multi_scenario_dialog( t_window* parent, t_multi_scenario_campaign_file_header_ptr const header_ptr, int map_selected, bool is_epilogue = true, t_adventure_map* map = 0 ); 

protected:
	void			add_tab( const char* tab_name, std::string const& label, 
								std::string const& help_text,
								void (t_multi_scenario_dialog::*function)(t_button*),
								bool pressed );
	void			campaign_info_clicked( t_button* button );
	void			create_buttons();
	void			create_campaign_info_controls();
	void			create_icons();
	void			create_text();
	void			initialize();
	void			player_difficulty_left_clicked( t_button* button );
	void			player_difficulty_right_clicked( t_button* button );
	void			scenario_details_clicked( t_button* button );
	void			scenario_info_clicked( t_button* button );
		                       
	t_window_ptr									m_campaign_info_controls; 
	t_multi_scenario_campaign_file_header_ptr const	m_file_header_ptr;
};

#endif // CAMPAIGN_DIALOG_H_INCLUDED